<%@page import="com.farm.parameter.FarmParameterService"%>
<%@ page language="java" pageEncoding="utf-8"%>
<%@page import="com.farm.web.constant.FarmConstant"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/view/conf/farmtag.tld" prefix="PF"%>
<script src="text/lib/dplayer/DPlayer.min.js"></script>
<style type="text/css">
.super_content {
	border-bottom: 0px;
}
</style>
<div
	style="background: #000000; border-radius: 8px; padding-top: 8px; padding-bottom: 6px;">
	<div id="player1" class="dplayer"></div>
</div>
<c:if
	test="${!empty hourview&&!empty hourview.hour&&!empty hourview.hour.progressis&&hourview.hour.progressis=='0'}">
	<script type="text/javascript">
		//alert('隐藏进度条');
	</script>
	<style>
		.dplayer .dplayer-bar-wrap {
			display: none;
		}
	</style>
</c:if>
<c:if
	test="${!empty hourview&&!empty hourview.hour&&!empty hourview.hour.continuis&&hourview.hour.continuis=='1'}">
	<script type="text/javascript">
		startProcess = parseInt('${empty hourview.playtime.duration?0:hourview.playtime.duration}');
	</script>
</c:if>
<script type="text/javascript">
	var mailDp;
	$(function() {
		var height = $(window).height() - 220;
		if (height > 860) {
			height = 860;
		}
		$('#player1').css('height', height);
		var dp = new DPlayer({
			element : document.getElementById('player1'),
			autoplay : false,
			theme : '#FADFA3',
			loop : false,
			lang : 'zh-cn',
			screenshot : false,
			hotkey : true,
			preload : 'auto',
			video : {
				url : '${playUrl}',
				pic : 'text/img/demo/playerIcon.png'
			},
			contextmenu : []
		});
		dp.on("ended", function() {
			openOperatorWin();
		});
		dp.on('loadeddata', function () {
			if(startProcess>1){ 
				 dp.seek(dp.video.duration * startProcess / 100);
			}
		});
		mailDp=dp;
	});
	//是否播放状态
	function isPlay() {
		return !mailDp.video.paused;
	}
	//停止视频播放
	function stopPlay() {
		mailDp.pause()
	}
	//获得当前播放时间（秒）
	function getPlayedSeccend() {
		return mailDp.video.currentTime;
	}
	//获得视频总长度（秒）
	function getPlayDuration() {
		return mailDp.video.duration;
	}
	//跳转到某个时间点
	function seekPlayedSeccend(seccend) {
		return mailDp.seek(seccend);
	}
</script>
